Class pyglet.window.Screen

A virtual monitor that supports fullscreen windows.

Screens typically map onto a physical display such as a monitor, television or projector. Selecting a screen for a window has no effect unless the window is made fullscreen, in which case the window will fill only that particular virtual screen.

The width and height attributes of a screen give the current resolution of the screen. The x and y attributes give the global location of the top-left corner of the screen. This is useful for determining if screens arranged above or next to one another.

You cannot always rely on the origin to give the placement of monitors. For example, an X server with two displays without Xinerama enabled will present two logically separate screens with no relation to each other.

Use Display.get_screens or Display.get_default_screen to obtain an instance of this class.

Methods

  __init__(self, x, y, width, height)
  __repr__(self)
pyglet.gl.Config get_best_config(self, template=None)
Get the best available GL config.
list of pyglet.gl.Config get_matching_configs(self, template)
Get a list of configs that match a specification.

Instance Variables

int height
Height of the screen, in pixels.
int width
Width of the screen, in pixels.
int x
Left edge of the screen on the virtual desktop.
int y
Top edge of the screen on the virtual desktop.

Method Details

get_best_config

get_best_config(self, template=None)

Get the best available GL config.

Any required attributes can be specified in template. If no configuration matches the template, NoSuchConfigException will be raised.

Parameters:
template : pyglet.gl.Config
A configuration with desired attributes filled in.
Returns:
pyglet.gl.Config: A configuration supported by the platform that best fulfils the needs described by the template.

get_matching_configs

get_matching_configs(self, template)

Get a list of configs that match a specification.

Any attributes specified in template will have values equal to or greater in each returned config. If no configs satisfy the template, an empty list is returned.

Parameters:
template : pyglet.gl.Config
A configuration with desired attributes filled in.
Returns:
list of pyglet.gl.Config: A list of matching configs.